﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FernUniHagen.CompilerExtension.Attributes
{
    
    public class AnyAttribute : Attribute, IMultiplicityAttribute
    {
        private Type _containerType;
        private object _fieldName;

        /// <summary>
        /// Definiert welche container klasse benutzt werden soll (etwa List)
        /// </summary>
        public Type ContainerType
        {
            get
            {
                return _containerType;
            }
            private set { _containerType = value; }
        }

        /// <summary>
        /// Definiert welche container klasse benutzt werden soll (etwa List)
        /// </summary>
        public object FieldName
        {
            get
            {
                return _fieldName;
            }
            private set { _fieldName = value; }
        }


        /// <summary>
        /// Konstruktor der Container entsprechend setzt
        /// </summary>
        /// <param name="containerType">typ des Containers etwa generische Liste</param>
        public AnyAttribute(Type containerType)
        {
            ContainerType = containerType;
        }

        /// <summary>
        /// adds the name of the field which represents the key in the qualified relation
        /// </summary>
        /// <param name="containerType">typ des Containers etwa generische Liste</param>
        /// <param name="fieldName">the key in the qualified relation</param>
        public AnyAttribute(Type containerType, object fieldName) : this(containerType)
        {
            FieldName = fieldName;
        }
    }
}
